import {useStore} from 'vuex'
import {computed} from 'vue'
//购物车相关逻辑
export const uesCommonCartEffect=(shopId)=>{
    const store = useStore();
    const cartList=store.state.cartList;
    const changeCartItemInfo=(shopId,productId,productInfo,num)=>{
        store.commit('changeCartItemInfo',{shopId,productId,productInfo,num})
    }
    //获取购物车列表
    const productList=computed(()=>{
    const productList=cartList[shopId]?.productList || []
    return productList
    })
    return {changeCartItemInfo,cartList,productList}
}

